<?php
header("Content-type:text/html; charset=gbk;");

$config = include('config.php');

$redis = include('conn.php');

$action = isset($_GET["action"]) ? $_GET["action"] : "";

$p1 = isset($_GET['p1']) ? addslashes($_GET['p1']) : "";
$p2 = isset($_GET['p2']) ? addslashes($_GET['p2']) : "";
$p3 = isset($_GET['p3']) ? addslashes($_GET['p3']) : "";
$p4 = isset($_GET['p4']) ? addslashes($_GET['p4']) : "";

if($action == "lPush"){
	
	$result = $redis->lPush($p1, $p2);
	var_dump($result);exit;
	
}else if($action == "rPush"){
	
	$result = $redis->rPush($p1, $p2);
	var_dump($result);exit;
}else if($action == "lPushx"){
	
	$result = $redis->lPushx($p1, $p2);
	var_dump($result);exit;
}else if($action == "rPushx"){
	
	$result = $redis->rPushx($p1, $p2);
	var_dump($result);exit;
}else if($action == "lPop"){
	
	$result = $redis->lPop($p1);
	var_dump($result);exit;
}else if($action == "rPop"){
	
	$result = $redis->rPop($p1);
	var_dump($result);exit;
}else if($action == "lSize"){
	
	$result = $redis->lSize($p1);
	var_dump($result);exit;
}else if($action == "lIndex"){
	
	$result = $redis->lIndex($p1, $p2);
	var_dump($result);exit;
}else if($action == "lSet"){
	
	$result = $redis->lSet($p1, $p2, $p3);
	var_dump($result);exit;
}else if($action == "lRange"){
	
	$result = $redis->lRange($p1, $p2, $p3);
	var_dump($result);exit;
}else if($action == "lTrim"){
	
	$result = $redis->lTrim($p1, $p2, $p3);
	var_dump($result);exit;
}else if($action == "lRem"){
	
	$result = $redis->lRem($p1, $p2, $p3);
	var_dump($result);exit;
}else if($action == "lInsert"){
	print_r($_GET);
	$result = $redis->lInsert($p1, Redis::AFTER, $p2, $p3);
	var_dump($result);exit;
}else if($action == "rpoplpush"){
	print_r($_GET);
	$result = $redis->rpoplpush($p1, $p2);
	var_dump($result);exit;
}

?>
